-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cpp_std option for Visual Studio C++ compiler #2836
Conversation
mesonbuild/compilers/cpp.py
Outdated
@@ -188,6 +188,9 @@ def get_options(self): | |||
'C++ exception handling type.', | |||
['none', 'a', 's', 'sc'], | |||
'sc'), | |||
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', | |||
['none', 'c++11', 'c++14', 'c++17', 'c++latest'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[E128] continuation line under-indented for visual indent
mesonbuild/compilers/cpp.py
Outdated
@@ -188,6 +188,9 @@ def get_options(self): | |||
'C++ exception handling type.', | |||
['none', 'a', 's', 'sc'], | |||
'sc'), | |||
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', | |||
['none', 'c++11', 'c++14', 'c++17', 'c++latest'], | |||
'none'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[E128] continuation line under-indented for visual indent
Wouldn't you have to check the MSVC version? in VS2015 there is only c++14 and c++latest, and in versions before that I don't think the switch is there. |
@jibsen right, I missed that. From what I gathered, MSVC tends to ignore unknown compiler flags, which is presumably why the VS2015 AppVeyor build surprisingly passed (VS2015 does not support C++17). Speaking of which, is there a way to disable the new |
You can skip a test with |
20005fc
to
faffe03
Compare
The patches should be ready. I am unsure as to why the VS2015 build on AppVeyor is failing. If someone more knowledgeful about AppVeyour could take a look, that'd be appreciated. Thanks! |
@jpakkane could you please restart that appveyor job? It error out due to an unrelated problem. |
The conceptual problem that this brings is that there are many projects that have default values for |
Good question. I am unconvinced that promoting a language version request for, say, C++11 to C++17, is a good idea. C++17 brings in a number of incompatibilities with the C++11 standard -- removal of the |
I think we should emit a warning when an invalid |
62fcd96
to
0374def
Compare
I've rebased the changes on top of current master. Can we get another round of reviews, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in getting this review done. It slipped through the cracks.
## Added `cpp_std` option for the Visual Studio C++ compiler | ||
|
||
Allows the use of C++17 features and experimental not-yet-standardized | ||
features. Valid options are `c++11`, `c++14`, `c++17`, and `c++latest`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added into the docs/markdown/snippets
directory.
@@ -221,6 +231,9 @@ def get_option_compile_args(self, options): | |||
std = options['cpp_eh'] | |||
if std.value != 'none': | |||
args.append('/EH' + std.value) | |||
std = options['cpp_std'] | |||
if std.value not in ['none', 'c++11']: | |||
args.append('/std:' + std.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this value added for c++11
? Please add a comment about that.
Also, why aren't we warning when cpp_std:
on an MSVC compiler that does not support the /std:
argument?
project('wincpp', 'cpp') | ||
|
||
if meson.get_compiler('cpp').version().version_compare('<19.11') | ||
error('MESON_SKIP_TEST Visual Studio 2017 (version 15.3) or later is required for C++17 support') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you skipping the test here? Also where's the cpp_std:
option set for this test?
The code around language version has changed so much that this probably requires a full reworking. Thus closing to reduce clutter on the MR page. Please open a new MR with updated code if you get this working against latest trunk. Thanks and sorry for the delay. |
No description provided.